/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package Taxi.db;

import Taxi.model.Maintenance;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;

/**
 *
 * @author WIN7
 */
public class MaintenanceDAO extends BaseDAO{

       public int saveMaint(Maintenance maint) throws SQLException {
        System.out.println("INSERT");
        Statement statement;
        statement = (Statement) Database.getConnection().createStatement();
        String insertStr = "";
        insertStr = "insert into maintenance (unitnumber, platenumber, description, odometer, price, date) values("
                + quotate(maint.getUnitnumber()) + ","
                + quotate(maint.getPlatenumber()) + ","
                + quotate(maint.getDescription()) + ","
                + quotate(maint.getOdometer()) + ","
                + quotate(maint.getPrice()) + ","
                + quotate(maint.getDate())
                + ")";

        return statement.executeUpdate(insertStr);
    }

}
